package com.qingmu.club.minaapi.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FontUtil {


    /**
     * 获取txt文件内容并按行放入list中
     */
    public static List<String> getFileContext(String path) throws Exception {
        FileReader fileReader =new FileReader(path);
        BufferedReader bufferedReader =new BufferedReader(fileReader);
        List<String> list =new ArrayList<String>();
        String str=null;
        while((str=bufferedReader.readLine())!=null) {
            if(str.trim().length()>2) {
                list.add(str.substring(0,str.length() - 1));
            }
        }
        return list;
    }
    public static boolean fontIllegal(String str)throws Exception{
        List<String> list = getFileContext("static/hx.txt");
        for(int i=0;i<list.size();i++){
            if(str.contains(list.get(i))){
             return false;
            }
        }
        return true;
    }

//    public static void main(String[] args) {
//
//        String str = "测试近平啊啊啊啊啊啊温家宝";
//        String replaceStr = "";
//
//        System.out.println("str:"+str);
//    }


}
